package com.cowin.sys.controller;
import com.cowin.base.result.Result;
import com.cowin.base.result.ResultGenerator;
import com.cowin.base.BaseController;
import com.cowin.sys.model.TmBasPlant;
import com.cowin.sys.model.TmBasWorkshop;
import com.cowin.sys.model.dto.Plant;
import com.cowin.sys.model.vo.ReportPlant;
import com.cowin.sys.model.vo.ReportWorkShop;
import com.cowin.sys.service.TmBasPlantService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Resource;
import java.util.List;

/**
 * Created by  on 2019/11/19.
 * @author CodeGenerator
 */
@Slf4j
@Api(value = "TmBasPlantController", description = "工厂基本信息控制器", tags = "TmBasPlantController", consumes = "application/json")
@RestController
@RequestMapping("/tm/bas/plant")
public class TmBasPlantController extends BaseController<TmBasPlant> {
    @Resource
    private TmBasPlantService tmBasPlantService;

    @ApiOperation(value = "查询工厂下的车间信息")
    @GetMapping("/workShop/{id}")
    public Result getWorkShop(@PathVariable Long id){
      List<TmBasWorkshop>  list = tmBasPlantService.getWorkShopById(id);
        return ResultGenerator.genSuccessResult(list);
    }
    @ApiOperation(value = "工厂车间产线 树结构")
    @GetMapping("/tree/detail")
    public Result getTreeDetail(){
        List<Plant>  list = tmBasPlantService.getTreeDetail();
        return ResultGenerator.genSuccessResult(list);
    }

    @ApiOperation(value = "工厂 车间 报工点 树结构")
    @GetMapping("/tree/report/uloc")
    public Result getTreeReportUloc(){
        List<ReportPlant>  list = tmBasPlantService.getTreeReportUloc();
        return ResultGenerator.genSuccessResult(list);
    }
}
